package com.qianfeng.task;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.annotation.Scheduled;

/*
 *@Description:
 *@author:刘哥
 *@Date:86180 2022/9/15 11:21
 */
public class CheckStatusTask {
    private ApplicationContext context;
    @Autowired
    public void setContext(ApplicationContext context) {
        this.context = context;
    }
    /**
     * 定时任务检查设备在线状态
     */
    @Scheduled(fixedRate = 30000)
    public void checkStatus() {
        context.publishEvent(new CheckStatusTask());
    }
}
